package com.wz.producerserv.service.impl;

import com.wz.producerserv.service.ProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.stereotype.Service;

@Service
public class ProducerServiceImpl implements ProducerService {

    @Autowired
    private ServerProperties serverProperties;

    public String addPrefix(String name, String prefix) {
        if ("FEIWU".equals(name)) {
            throw new NullPointerException();
        }

//        try {
//            Thread.sleep(4000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

        return serverProperties.getPort() + ":" + prefix + "," + name;
    }

}
